package com.markyao.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class HostUtils {

    public static String getThisHost() {
        InetAddress addr = null;
        try {
            addr = InetAddress.getLocalHost();
//            System.out.println("Local HostAddress:"+addr.getHostAddress());
//            String hostname = addr.getHostName();
            return addr.getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        return null;
    }
}
